/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */
#include "BoxColliderControl.h"

#include <QtGui/QLayout>
#include <QtGui/QMouseEvent>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QCheckBox>

namespace PQBuilder
{
	BoxColliderControl::BoxColliderControl(QWidget *parent,PQEngine::BoxColliderComponent* component)
	{

		if(component!=0){
			Ogre::Vector3 size=component->getSize();
			Ogre::Vector3 pos=component->getPosition();

			QGridLayout* grid=new QGridLayout(this);

			QLabel* labelSize=new QLabel(QObject::tr("Size"),this);
			QLabel* labelSizeX=new QLabel("X",this);
			QLineEdit* editSizeX=new QLineEdit(this);
			labelSizeX->setAlignment(Qt::AlignHCenter);

			editSizeX->setText(QString().setNum(size.x));

			QLabel* labelSizeY=new QLabel("Y",this);
			QLineEdit* editSizeY=new QLineEdit(this);
			labelSizeY->setAlignment(Qt::AlignHCenter);
			editSizeY->setText(QString().setNum(size.y));

			QLabel* labelSizeZ=new QLabel("Z",this);
			QLineEdit* editSizeZ=new QLineEdit(this);
			labelSizeZ->setAlignment(Qt::AlignHCenter);
			editSizeZ->setText(QString().setNum(size.z));

			QLabel* labelCenter=new QLabel(QObject::tr("Center"),this);

			QLabel* labelCenterX=new QLabel("X",this);
			QLineEdit* editCenterX=new QLineEdit(this);
			labelCenterX->setAlignment(Qt::AlignHCenter);
			editCenterX->setText(QString().setNum(pos.x));

			QLabel* labelCenterY=new QLabel("Y",this);
			QLineEdit* editCenterY=new QLineEdit(this);
			labelCenterY->setAlignment(Qt::AlignHCenter);
			editCenterY->setText(QString().setNum(pos.y));

			QLabel* labelCenterZ=new QLabel("Z",this);
			QLineEdit* editCenterZ=new QLineEdit(this);
			labelCenterZ->setAlignment(Qt::AlignHCenter);
			editCenterZ->setText(QString().setNum(pos.z));

			grid->addWidget(labelSize,0,0,1,2);

			grid->addWidget(labelSizeX,1,0);
			grid->addWidget(editSizeX,1,1);

			grid->addWidget(labelSizeY,2,0);
			grid->addWidget(editSizeY,2,1);

			grid->addWidget(labelSizeZ,3,0);
			grid->addWidget(editSizeZ,3,1);
			
			grid->addWidget(labelCenter,4,0,1,2);

			grid->addWidget(labelCenterX,5,0);
			grid->addWidget(editCenterX,5,1);

			grid->addWidget(labelCenterY,6,0);
			grid->addWidget(editCenterY,6,1);

			grid->addWidget(labelCenterZ,7,0);
			grid->addWidget(editCenterZ,7,1);

			this->setLayout(grid);
		}
		
	}

	BoxColliderControl::~BoxColliderControl()
	{
	}
	
}
